package org.link.service;

import java.util.UUID;

import org.link.bean.Account;
import org.link.dao.AccountDao;
import org.link.dao.IAccountDao;

/**
 * 
 * project_name:hibernatedemo
 * package_name:org.link.service
 * file_name:AccountService.java
 * @author Link
 * create_date:2015年12月11日 上午9:34:16
 * modified_date:
 * description:业务层
 *
 */
public class AccountService implements IAccountService {
	
	private IAccountDao accountDao = new AccountDao();

	/**
	 * 添加账户
	 */
	public void addAccount(Account account) {
		account.setId(UUID.randomUUID().toString());
		accountDao.addAccount(account);
	}

	/**
	 * 通过id查找账户信息
	 */
	public Account getAccountById(String id) {
		Account account = accountDao.getAccountById(id);
		return account;
	}

	/**
	 * 转账
	 */
	public void transferAccount(String payId, String gatherId, String money) {
		accountDao.updateAccountById(payId, gatherId, money);
	}
	
}
